<style>
</style>
<div id="allmap" style="height: 11rem;padding:0px 0px;width: 100%"></div>
<div class="fui-cell-group" style="margin-top: 0">
<div class="fui-cell">
    <div class="fui-cell-label" style="width: auto;padding-right: 0.3rem"><i class="icon icon-map red"></i></div>
    <div class="fui-cell-info">您所在的服务区域</div>
    <div class="fui-cell-remark" ng-click="tool.choose_location(pagedata,'addressinfo')">{{pagedata.addressinfo.title||'默认附近区域'}}</div>
</div>
<div class="fui-cell">
    <div class="fui-cell-label" style="width: auto;padding-right: 0.3rem"><i class="icon icon-all red"></i></div>
    <div class="fui-cell-info">您想要的服务类目</div>
    <div class="fui-cell-remark">
        <select ng-model="pagedata.params.pid" ng-change="access_json('/shop.groups//pid='+pagedata.params.pid)">
            <option ng-repeat="q in pagedata.category" value="{{q.id}}">{{q.title}}</option>
        </select>
    </div>
</div>
</div>
<script>
	window.scope.location(function(res){
		if(!scope.pagedata.pcd.city){
			scope.pagedata.pcd.province = res.addressComponents.province;
			scope.pagedata.pcd.city = res.addressComponents.city;
		}
		scope.pagedata.pcd.lat = res.lat_lng.lat;
		scope.pagedata.pcd.lng = res.lat_lng.lng;
		scope.tool.get_list('jy_shifu/index/getworkers/lat='+scope.pagedata.pcd.lat+'&lng='+scope.pagedata.pcd.lng,true,function(res){
			require(['map'], function(BMap){
				var map = new BMap.Map("allmap");
				var list=res.list;
				var first=res.list[0];
				if(first){
					var point = new BMap.Point(first.lat_lng.lng, first.lat_lng.lat);
				}else{
					var point = new BMap.Point(scope.pagedata.pcd.lng, scope.pagedata.pcd.lat);
				}
				map.centerAndZoom(point, 13.6);
				// 编写自定义函数,创建标注
				function addMarker(point,icon){
					var marker = new BMap.Marker(point);
					var icon=new BMap.Icon(icon,new BMap.Size(26,26));
                    icon.setImageSize(new BMap.Size(26,26));
					marker.setIcon(icon);
					map.addOverlay(marker);
				}
				for (var i = 0; i < list.length; i ++) {
					var point = new BMap.Point(list[i].lat_lng.lng, list[i].lat_lng.lat);
					addMarker(point,list[i].iconPath,'32323232');
				}
			});
		});
	});
</script>